package com.bounds.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.bounds.dao.HospitalDao;
import com.bounds.entity.Hospital;
import com.bounds.entity.Pager;

@SuppressWarnings("serial")
public class HospitalAction extends BaseAction {
	private Hospital hospital;
	private List<Hospital> hospitals;
	private Pager<Hospital> page;
	@Autowired
	private HospitalDao hospitalDao;

	public String list(){
		hospitals = hospitalDao.qryHospitals(hospital);
		return "list";
	}
	
	public String listForPage(){
		page = this.hospitalDao.qryHospitalsForPager(hospital, getPageNo(), getPageSize());
		return "page";
	}
	
	public String add(){
		this.hospitalDao.addHospital(hospital);
		return "goBack";
	}
	
	public String delete(){
		this.hospitalDao.deleteHospital(hospital.getId());
		return "goBack";
	}
	public Hospital getHospital() {
		return hospital;
	}

	public void setHospital(Hospital hospital) {
		this.hospital = hospital;
	}

	public List<Hospital> getHospitals() {
		return hospitals;
	}

	public Pager<Hospital> getPage() {
		return page;
	}
	
}
